package crypto.main;

import crypto.process.*;
import crypto.reference.References;
import crypto.util.*;

/*
 *@author faku y GaTo
 */
/**
 * DOCUMENT ME!
 *
 * @author $author$
 * @version $Revision$
 */
public class DeCrypto {
    
    private Matrix           matrix      = new Matrix();
    private CompleteBlock    complete    = new CompleteBlock();
    private DeleteEmptySpace delete      = new DeleteEmptySpace();
    private Sustitution      sustitution = new Sustitution();
    private References reference = new References();
    
    public String decrypt( String textE, String references ){
        
        reference.unhideKeysInText(textE, references);

        //String text = sustitution.substractCharacter(textE, reference);
        //text = delete.insertEmpty(text, reference);
        String text = complete.restoreBlock(textE, reference);
        text = matrix.textNormalCase(text, reference);

        return text;
    }

}
